package com.yonyou.iuap.controller.app;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yonyou.iuap.pub.JsonUtils;
import com.yonyou.iuap.shell.entity.BdIndustryChartEntity;
import com.yonyou.iuap.shell.pub.ResultDto;
import com.yonyou.iuap.shell.service.intf.IIndustryChartService;

/**
 * 关键字 表
 * **/
@Controller
@RequestMapping("/IndustryChart")
public class IndustryChartController {
	private final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
	private long start,end;
	@Autowired 
	private IIndustryChartService iIndustryChartService;
	  @RequestMapping(value="App/likeName", method=RequestMethod.GET)  
	    public @ResponseBody String LikeIKnowledgeCategory(HttpServletRequest resq,@RequestBody HashMap parMap) {
		  start=System.currentTimeMillis();
		  ResultDto rsdto = new ResultDto();
		  String likeName=parMap.get("likeName").toString();
			if(StringUtils.isEmpty(likeName)){
				rsdto=iIndustryChartService.selectByCondition(likeName);
			}else{
		    	StringBuffer str=new StringBuffer();
		    	str.append("cate_type != 0");
		    	str.append(" and cate_name like '%"+likeName+"%'");
		    	rsdto=iIndustryChartService.selectByCondition(str.toString());
			}
	    	String rs_json=JsonUtils.toJsonStr(rsdto);
	    	end=System.currentTimeMillis();
			logger.info("likeName接口调用时间"+String.valueOf(end-start));
	        return rs_json;  
	    }

	
	
	

}
